<?php
/**
 * Created by PhpStorm
 * User: whh
 * Date: 2022/7/28
 * Time: 16:02
 */

namespace app\common\model;


use think\Model;

class QuickAppInfo extends Model
{
    use Common;

    protected $table = 'quick_app_info';
    protected $pk = 'quick_id';

    /**
     * 订阅参数初始化格式
     * @return \string[][]
     * @Author: whh
     */
    public static function initSendConfig()
    {
        return [
            'huawei' => [
                'HW_PUSH_SERVER' => '',
                'HW_TOKEN_SERVER' => '',
                'HW_FAST_APPID' => '',
                'HW_FAST_APPSECRET' => '',
            ],
            'xiaomi' => [
                'secret' => ''
            ],
            'vivo' => [
                'appId' => '',
                'appKey' => '',
                'appSecret' => '',
            ],
            'OPPO' => [
                'AppKey' => '',
                'MasterSecret' => '',
            ]
        ];
    }

    public function getSendConfigAttr($value)
    {
        if ($value) {
            $value = json_decode($value, true);
        }else{
            $value = null;
        }
        return $value;
    }

    public function setSendConfigAttr($value)
    {
        return json_encode($value);
    }
}